Migrate device endpoints to generated models#6547
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
SDK Size Comparison 📏
|
464cbfc to
a91a64c
Compare
9048f69 to
32c54f4
Compare
932db00 to
dc1ead9
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (16)
💤 Files with no reviewable changes (1)
WalkthroughDevice-add and device-list network models are migrated from ChangesDevice Model Migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant MoshiChatApi
participant DeviceApi
participant Serializer
MoshiChatApi->>DeviceApi: addDevices(CreateDeviceRequest)
DeviceApi->>Serializer: serialize PushProvider field
Serializer-->>DeviceApi: JSON payload
DeviceApi-->>MoshiChatApi: RetrofitCall<Unit> response
MoshiChatApi->>DeviceApi: getDevices()
DeviceApi-->>MoshiChatApi: RetrofitCall<ListDevicesResponse>
MoshiChatApi->>MoshiChatApi: map DeviceResponse to Device (toDomain)
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|


Goal
Migrate the
/devicesendpoints to generated models. Part of the incremental OpenAPI model migration.Built on top of the Serializer foundation PR (this is the first slice with a generated enum,
PushProvider).Part of AND-1291
Implementation
DeviceResponse,ListDevicesResponse, andCreateDeviceRequest(with the typedPushProvidersealed enum); delete the hand-writtenDeviceDto,DevicesResponse, andAddDeviceRequest.CreateDeviceRequest.PushProvider.PushProviderAdapter()inSerializer(the one-line-per-enum pattern the foundation enables).DeviceApi/MoshiChatApi/mappers at the generated types (real names, no aliases);Device.toDto()supplies placeholdercreatedAt/userId(required by the generated model, ignored by the server on upstream payloads).Testing
spotlessApply,apiDump(no API drift),lint,detekt, andtestDebugUnitTestall pass.addDevice(generated request +PushProviderenum) succeeds,getDevicesparses 22 realDeviceResponses (roundTrip=true),deleteDevicesucceeds.Summary by CodeRabbit
New Features
Bug Fixes